﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
using Axis.Web.Administrator.Global;
using Axis.BusinessObject.Research;
using Axis.Dao.Research;

namespace Axis.Web.Administrator.Views.News
{
    public class CNewsUI
    {
        CCore cCore = new CCore();
        public string GetProjectName() {
            string Result = "";

            XmlDocument doc = new XmlDocument();
            XmlElement root = doc.CreateElement("InputValue");
            doc.AppendChild(root);
            root.SetAttribute("UserID", CSecurity.USER_ID.ToString());
            root.SetAttribute("SecrectToken", CSecurity.SECRECT_TOKEN.ToString());
            string inputValueResearch = doc.OuterXml;
            CResearchDao projectDao = new CResearchDao();
            IList<CProject> listResearch = projectDao.GetProject(inputValueResearch);
            Result += "<option value=''>..</option>";
            Result += " <optgroup label='Khảo sát'>";
            foreach (var item in listResearch)
                Result += string.Format("<option value='{0}' >{1}</option>", item.ID, item.Name);
            Result += " </optgroup>";
            root.SetAttribute("Type","1");
            string inputValue6sao = doc.OuterXml;
            IList<CProject> list6sao = projectDao.GetProject(inputValue6sao);
            Result += " <optgroup label='6 Sao'>";
            foreach (var item in list6sao)
                Result += string.Format("<option value='{0}' >{1}</option>", item.ID, item.Name);
            Result += " </optgroup>";
            return Result;
        }

    }
}